<?php

session_start();
include_once( 'config.php' );
include_once( 'weibooauth.php' );


$c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret']  );
$ms  = $c->home_timeline(); // done
//$me = $c->verify_credentials();
if(!empty($_POST["sub"])){
	$c->update($_POST["con"]);
}


//关注某人：
if(!empty($_POST["sub2"])){
	$c->follow($_POST["username"]);
}


//关注某人：
if(!empty($_POST["sub3"])){
	$t="测试。。。。信息00000";
	
	//制作水印图片
	$im=imagecreatefromjpeg("bg.jpg");
	$color=imagecolorallocate($im,0,0,255);
	imagettftext($im,14,0,143,65,$color,"Youyuan.TTF","afeiTest!!!!");
	imagejpeg($im,"afei.jpg");
	$p="http://localhost/php100/weibo/afei.jpg";
	$c->upload($t,$p);
}



?>

<form action="" method="post">
<input type="text" name="con" id="" />
<input type="submit" value="发表微博" name="sub" />
</form>


<form action="" method="post">
<input type="text" name="username" id="" />
<input type="submit" value="关注某人" name="sub2" />
</form>

<form action="" method="post">
<input type="text" name="testYY" id="" />
<input type="submit" value="小小应用" name="sub3" />
</form>

